projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
4a5190f
)
* lisp/dom.el (dom-previous-sibling): New function.
author
Lars Magne Ingebrigtsen
<larsi@gnus.org>
Sun, 22 Feb 2015 12:09:30 +0000
(13:09 +0100)
committer
Lars Magne Ingebrigtsen
<larsi@gnus.org>
Sun, 22 Feb 2015 12:09:54 +0000
(13:09 +0100)
lisp/dom.el
patch
|
blob
|
history
diff --git
a/lisp/dom.el
b/lisp/dom.el
index 11357e88804bd92254c4e574831aa268121349f4..42131073a04e2a5e0591bf0fc2e48ec10c1f5886 100644
(file)
--- a/
lisp/dom.el
+++ b/
lisp/dom.el
@@
-149,6
+149,16
@@
ATTRIBUTE would typically be `class', `id' or the like."
(setq result (dom-parent elem node))))
result)))
+(defun dom-previous-sibling (dom node)
+ (when-let (parent (dom-parent dom node))
+ (let ((siblings (dom-children parent))
+ (previous nil))
+ (while siblings
+ (when (eq (cadr siblings) node)
+ (setq previous (car siblings)))
+ (pop siblings))
+ previous)))
+
(defun dom-node (tag &optional attributes &rest children)
"Return a DOM node with TAG and ATTRIBUTES."
(if children